<?php
require_once 'conf.inc';
	class logger {
		private $log_directory;
		private $log_file;
		
		public function log($error, $type){
			$log_directory = $this->get_log_directory();
			$log_file = $this->get_log_file();
			try {
				if(!file_exists($log_directory."/".$log_file)){
					throw new Exception("Log Directory doesn't exist - Please create one in <b>".$log_directory."/".$log_file."</b>");
				}
				$f = fopen("var/logs/log.txt", "a");
				fwrite($f, date('d:m:Y g:i:s a', time())." " .$error." Error_Type=".$type."\r\n");
				fclose($f);
			}
			catch(Exception $e){
				echo $e->getmessage();
			}
		}
		public function set_log_directory($log_directory){
			$this->log_directory = $log_directory;
		}
		public function set_log_file($log_file_name){
			$this->log_file = $log_file_name;
		}
		public function get_log_directory(){
			return $this->log_directory;
		}
		public function get_log_file(){
			return $this->log_file;
		}
	}
?>